function uwm_obj=uwm_obj(x)

global pbar eta theta0 uwbar psi  bl bm bk q N 


uwm0=x(1,1);
%uwk0=x(1,2);
uwk0 = uwm0
Nobs = N(1,1)

% constants
ceta = eta(1,1)
cpsi = psi(1,1)
cbl = bl(1,1)
cbm = bm(1,1)
cbk = bk(1,1)
%%
I = ones(Nobs,1)
qhat = (((cbl*pbar.*(I+ceta*theta0))./(uwbar.*(I+cpsi*theta0))) .^(cbl/(1+cpsi)).*((cbm*pbar.*(I+ceta*theta0))./(uwm0)).^(cbm).*(cbk.*pbar.*(I+ceta*theta0)/uwk0).^(cbk)).^(1/(1-(1+1*ceta)*cbl./(1+1*cpsi) - (1+1*ceta)*cbm - (1+1*ceta)*cbk ))
 

uwm_obj = (mean(q)   - mean(qhat))^2

 